var express = require('express');
var router = express.Router();
let { shujuModel, xxinModel } = require('../modu/lyl')
let { xinModel } = require('../modu/jfq')
let { biao } = require('../modu/hzy')
/* GET home page. */


router.get('/getuse', async (req, res) => {
    let booy = req.query
    //登录用户的id
    console.log(booy.id);
    let date = await xxinModel.find({ usepid: booy.id })
    res.send({
        date
    })
})

//获取用户信息数据
router.get('/getqyxn', async (req, res) => {
    let list = []
    let fv = []
    let fvc = []
    let date = await xxinModel.find({})
    date.forEach(item => {
        if (item.juese == 'qunid') {
            list.push(item)
        }
    })
    fvc = await xinModel.find()
    list.forEach((item => {
        fvc.forEach(item2 => {
            if (String(item.usepid) === String(item2._id)) {
                fv.push(item2)
            }
        })
    }))
    res.send({
        fv
    })

})



//获取用户信息数据
// router.post('/liaotzx', async (req, res) => {
//     let shuju = req.body
//     await talkroomModel.create({ username: shuju.msg.username, info: shuju.msg.info, roomid: shuju.msg.roomid })
// })

//接受消息
// router.post('/jiexiao', async (req, res) => {
//     let booy = req.body
//     if (booy, key == 1) {
//         let data = await biao.find({})
//         await shujuModel.create({})
//     } else {
//         await shujuModel.create({})
//     }
// })


module.exports = router;